package com.ruoyi.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqConfig {

    /**
     * PublishSubscribeQueueA 队列名称
     * PublishSubscribeExchange 交换机名称
     * @return
     */

    @Bean
    public Queue PublishSubscribeQueueA() {
        return new Queue("hospitalQueue",true);
    }

    @Bean
    public FanoutExchange PublishSubscribeExchange() {
        return new FanoutExchange("hospitalExchange");
    }

    @Bean
    public Binding bingQueueAToPublishSubscribeExchange() {
        return BindingBuilder.bind(new Queue("hospitalQueue",true)).to(new FanoutExchange("hospitalExchange"));
    }


}
